package com.zuper.demo.sessionlogin.base;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;

import com.zuper.demo.sessionlogin.constant.SysConsts;

public class BaseCtrller {
	@Autowired
	protected  HttpServletRequest request;

	@Autowired
	protected HttpServletResponse response;
	
	protected ServletContext getServletContext() {
		return request.getServletContext();
	}
	
	//用户id
	protected Integer getSessionUserId() {
		return (Integer) request.getSession().getAttribute(SysConsts.Session_UserId);
	}
	
	//用户名
	protected String getSessionUsername() {
		return (String) request.getSession().getAttribute(SysConsts.Session_Username);
	}
	
	//用户昵称（显示）
	protected String getSessionNickname() {
		return (String) request.getSession().getAttribute(SysConsts.Session_Nickname);
	}
	
}
